```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MySQL INT(11) 详解 - 技术小馆</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        .hero {
            background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
        }
        .card {
            transition: all 0.3s ease;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
        }
        .highlight {
            background: linear-gradient(90deg, rgba(238,174,202,0.2) 0%, rgba(148,187,233,0.2) 100%);
            border-left: 4px solid #6e8efb;
        }
        .drop-cap::first-letter {
            font-family: 'Noto Serif SC', serif;
            float: left;
            font-size: 3.5em;
            line-height: 0.9;
            padding-right: 8px;
            margin-top: 4px;
            color: #6e8efb;
            font-weight: 700;
        }
        a:hover {
            color: #6e8efb;
            text-decoration: underline;
        }
        footer {
            background-color: #1a1a1a;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-5xl text-center">
            <h1 class="text-4xl md:text-5xl font-bold mb-6 font-serif">MySQL <span class="text-yellow-200">INT(11)</span> 深度解析</h1>
            <p class="text-xl md:text-2xl font-light mb-8 max-w-3xl mx-auto">揭开显示宽度的神秘面纱，理解MySQL整数类型的真正含义</p>
            <div class="flex justify-center space-x-4">
                <a href="#content" class="bg-white text-indigo-600 px-6 py-3 rounded-lg font-medium hover:bg-opacity-90 transition duration-300">
                    <i class="fas fa-book-open mr-2"></i>开始阅读
                </a>
                <a href="#visualization" class="bg-indigo-800 bg-opacity-50 text-white px-6 py-3 rounded-lg font-medium hover:bg-opacity-70 transition duration-300">
                    <i class="fas fa-chart-pie mr-2"></i>可视化解析
                </a>
            </div>
        </div>
    </section>

    <!-- Content Section -->
    <section id="content" class="py-16 px-4 md:px-0">
        <div class="container mx-auto max-w-4xl">
            <article class="prose prose-lg max-w-none">
                <div class="drop-cap">
                    <p>在MySQL中，<code class="bg-gray-100 px-2 py-1 rounded">int(11)</code>中的<code class="bg-gray-100 px-2 py-1 rounded">11</code>实际上并不代表存储的字节数或范围，而是用来定义显示宽度的。这个看似简单的数字背后隐藏着MySQL数据类型设计的精妙之处。</p>
                </div>
                
                <h2 class="text-3xl font-bold mt-12 mb-6 border-b pb-2 font-serif">1. <code class="text-indigo-600">int(11)</code> 的真正含义</h2>
                
                <div class="grid md:grid-cols-2 gap-8 mb-12">
                    <div class="card bg-white p-6 rounded-lg">
                        <div class="flex items-center mb-4">
                            <div class="bg-indigo-100 p-3 rounded-full mr-4">
                                <i class="fas fa-database text-indigo-600 text-xl"></i>
                            </div>
                            <h3 class="text-xl font-bold text-gray-800">存储机制</h3>
                        </div>
                        <p class="text-gray-700"><code>INT</code>是一种用于存储整数的类型，通常占用4个字节的存储空间（32位），它可以存储的数值范围是从-2,147,483,648到2,147,483,647。无论你在定义<code>INT</code>时指定的宽度是多少，比如<code>int(11)</code>或者<code>int(4)</code>，其实际占用的存储空间始终是4个字节，这与显示宽度无关。</p>
                    </div>
                    
                    <div class="card bg-white p-6 rounded-lg">
                        <div class="flex items-center mb-4">
                            <div class="bg-purple-100 p-3 rounded-full mr-4">
                                <i class="fas fa-desktop text-purple-600 text-xl"></i>
                            </div>
                            <h3 class="text-xl font-bold text-gray-800">显示宽度</h3>
                        </div>
                        <p class="text-gray-700"><code>int(11)</code>中的<code>11</code>指的是该整数的<strong>显示宽度</strong>，即默认情况下MySQL用多少位数字来显示这个整数。如果存储的数值的位数少于<code>11</code>，在某些情况下（如启用<code>ZEROFILL</code>），会在左边自动填充零。例如，如果你存储的值是<code>123</code>，在定义了<code>int(11)</code>并启用<code>ZEROFILL</code>时，MySQL会将其显示为<code>00000000123</code>。</p>
                    </div>
                </div>
                
                <div class="highlight p-6 rounded-lg mb-12">
                    <div class="flex items-start">
                        <i class="fas fa-info-circle text-indigo-600 text-2xl mr-4 mt-1"></i>
                        <div>
                            <h3 class="text-xl font-bold mb-2">重要提示</h3>
                            <p class="mb-0">显示宽度仅在某些工具或特定的MySQL配置中体现。在大多数实际应用场景中，它对查询结果的输出并没有直接影响。从MySQL 8.0开始，<code>INT</code>类型的显示宽度已经被废弃，官方建议不再依赖显示宽度参数。</p>
                        </div>
                    </div>
                </div>
                
                <h2 class="text-3xl font-bold mt-12 mb-6 border-b pb-2 font-serif">2. 显示宽度的局限性</h2>
                
                <p>显示宽度并不是一种强制性的格式，它只是给定一个输出的默认格式。实际上：</p>
                
                <ul class="space-y-4 my-6">
                    <li class="flex items-start">
                        <div class="bg-indigo-100 w-6 h-6 rounded-full flex items-center justify-center mr-3 flex-shrink-0">
                            <i class="fas fa-exclamation text-indigo-600 text-xs"></i>
                        </div>
                        <span><strong>无<code>ZEROFILL</code>的影响</strong>：如果没有启用<code>ZEROFILL</code>，<code>int(11)</code>和<code>int(4)</code>的显示效果是一样的，MySQL不会自动在前面填充零。它仅表示最大位数为11，但在实际操作中并没有强制限制。</span>
                    </li>
                    <li class="flex items-start">
                        <div class="bg-indigo-100 w-6 h-6 rounded-full flex items-center justify-center mr-3 flex-shrink-0">
                            <i class="fas fa-exclamation text-indigo-600 text-xs"></i>
                        </div>
                        <span><strong>已废弃的功能</strong>：从MySQL 8.0开始，<code>INT</code>类型的显示宽度已经被废弃，官方建议不再依赖显示宽度参数，因为它不会影响任何实质上的数据处理行为。</span>
                    </li>
                </ul>
                
                <h2 class="text-3xl font-bold mt-12 mb-6 border-b pb-2 font-serif">3. <code>int(11)</code> 的实际应用</h2>
                
                <p>在早期MySQL版本中，显示宽度可能会被某些工具或开发者误解为影响存储空间或数值范围，但实际上这只是对输出格式的一种定义。</p>
                
                <div class="grid md:grid-cols-2 gap-8 mt-8">
                    <div class="bg-white p-6 rounded-lg shadow-sm">
                        <h3 class="text-xl font-bold mb-4 flex items-center">
                            <i class="fas fa-file-alt text-blue-500 mr-3"></i>
                            <span>显示格式控制</span>
                        </h3>
                        <p>在一些表单或报表生成中，你可能希望输出的整数在某个固定长度的字段中显示，使用<code>int(11)</code>并配合<code>ZEROFILL</code>就可以确保输出格式一致。</p>
                    </div>
                    <div class="bg-white p-6 rounded-lg shadow-sm">
                        <h3 class="text-xl font-bold mb-4 flex items-center">
                            <i class="fas fa-history text-purple-500 mr-3"></i>
                            <span>历史兼容性</span>
                        </h3>
                        <p>许多早期的MySQL数据库设计中，可能会见到<code>int(11)</code>的定义，但这主要是为了符合某些格式要求或约定，而不是因为存储需要。</p>
                    </div>
                </div>
                
                <div class="mt-12 p-6 bg-yellow-50 border-l-4 border-yellow-400 rounded">
                    <h3 class="text-xl font-bold mb-2 flex items-center">
                        <i class="fas fa-lightbulb text-yellow-600 mr-2"></i>
                        <span>最佳实践建议</span>
                    </h3>
                    <p>对于新项目，除非有特定的格式化需求，否则可以直接使用<code>INT</code>而不指定显示宽度。这样可以避免不必要的混淆，并使代码更加简洁明了。</p>
                </div>
            </article>
        </div>
    </section>
    
    <!-- Visualization Section -->
    <section id="visualization" class="py-16 bg-gray-50 px-4 md:px-0">
        <div class="container mx-auto max-w-4xl">
            <h2 class="text-3xl font-bold mb-12 text-center font-serif">MySQL INT 类型可视化解析</h2>
            
            <div class="bg-white rounded-lg shadow-lg p-6 mb-12">
                <div class="mermaid">
                    graph TD
                    A[INT(11)] --> B[存储空间]
                    A --> C[显示宽度]
                    B --> D[固定4字节]
                    B --> E[范围:-2,147,483,648到2,147,483,647]
                    C --> F[默认显示位数:11]
                    C --> G[配合ZEROFILL使用]
                    G --> H[左侧补零显示]
                    style A fill:#f0f9ff,stroke:#6e8efb
                    style B fill:#f0f9ff,stroke:#6e8efb
                    style C fill:#f0f9ff,stroke:#6e8efb
                </div>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8">
                <div class="bg-white p-6 rounded-lg shadow-sm">
                    <h3 class="text-xl font-bold mb-4 flex items-center">
                        <i class="fas fa-table text-indigo-500 mr-3"></i>
                        <span>INT类型比较</span>
                    </h3>
                    <div class="overflow-x-auto">
                        <table class="min-w-full bg-white">
                            <thead>
                                <tr class="bg-gray-100">
                                    <th class="py-2 px-4 border">类型</th>
                                    <th class="py-2 px-4 border">存储空间</th>
                                    <th class="py-2 px-4 border">最小值</th>
                                    <th class="py-2 px-4 border">最大值</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td class="py-2 px-4 border">TINYINT</td>
                                    <td class="py-2 px-4 border">1字节</td>
                                    <td class="py-2 px-4 border">-128</td>
                                    <td class="py-2 px-4 border">127</td>
                                </tr>
                                <tr class="bg-gray-50">
                                    <td class="py-2 px-4 border">SMALLINT</td>
                                    <td class="py-2 px-4 border">2字节</td>
                                    <td class="py-2 px-4 border">-32,768</td>
                                    <td class="py-2 px-4 border">32,767</td>
                                </tr>
                                <tr>
                                    <td class="py-2 px-4 border">MEDIUMINT</td>
                                    <td class="py-2 px-4 border">3字节</td>
                                    <td class="py-2 px-4 border">-8,388,608</td>
                                    <td class="py-2 px-4 border">8,388,607</td>
                                </tr>
                                <tr class="bg-gray-50">
                                    <td class="py-2 px-4 border">INT</td>
                                    <td class="py-2 px-4 border">4字节</td>
                                    <td class="py-2 px-4 border">-2,147,483,648</td>
                                    <td class="py-2 px-4 border">2,147,483,647</td>
                                </tr>
                                <tr>
                                    <td class="py-2 px-4 border">BIGINT</td>
                                    <td class="py-2 px-4 border">8字节</td>
                                    <td class="py-2 px-4 border">-9,223,372,036,854,775,808</td>
                                    <td class="py-2 px-4 border">9,223,372,036,854,775,807</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                
                <div class="bg-white p-6 rounded-lg shadow-sm">
                    <h3 class="text-xl font-bold mb-4 flex items-center">
                        <i class="fas fa-code text-blue-500 mr-3"></i>
                        <span>示例代码</span>
                    </h3>
                    <pre class="bg-gray-100 p-4 rounded-md overflow-x-auto">
<code class="text-sm">-- 创建表时指定INT显示宽度
CREATE TABLE example (
    id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    quantity INT(5) ZEROFILL,
    normal_int INT
);

-- 插入数据
INSERT INTO example (quantity, normal_int) 
VALUES (123, 123), (5, 5);

-- 查询结果
-- 启用ZEROFILL的quantity会显示为00123和00005
-- normal_int则正常显示123和5
SELECT * FROM example;</code></pre>
                </div>
            </div>
        </div>
    </section>
    
    <!-- Footer -->
    <footer class="py-12 text-white">
        <div class="container mx-auto max-w-4xl px-4 text-center">
            <h3 class="text-xl font-bold mb-4">技术小馆</h3>
            <p class="text-gray-400 mb-6">探索技术奥秘，分享知识精华</p>
            <div class="flex justify-center space-x-4">
                <a href="http://www.yuque.com/jtostring" class="text-gray-300 hover:text-white transition duration-300">
                    <i class="fas fa-globe mr-2"></i>http://www.yuque.com/jtostring
                </a>
            </div>
            <div class="mt-8 pt-6 border-t border-gray-800 text-gray-500 text-sm">
                &copy; 2023 技术小馆. 保留所有权利.
            </div>
        </div>
    </footer>
    
    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>
```